#include "BlockGenerator.h"
using namespace std;

void base_block(string file, float lines, float columns) {

	vector<string> component_names;
	ofstream output;
	output.open (file);

	for (float x = 0.0; x < lines; x++)
		for (float z = 0.0; z < columns; z++) {
			std::string result;
			std::string block_name = "block_green_x";
			std::stringstream sstm;
			sstm << block_name << x << "_z" << z;
			result = sstm.str();
			component_names.push_back(result);

		output << "<component id=\"" << result << "\">"							<< endl;
		output << "<transformation>"											<< endl;
		output << "<translate x=\"" << x*10 << "\" y=\"0.0\" z=\"" << z*10 << "\" />" << endl;
		output << "</transformation>"				<< endl;
		output << "<materials>"						<< endl;
		output << "<material id=\"green\" />"		<< endl;
		output << "</materials>"					<< endl;
		output << "<texture id=\"grass\" />"		<< endl;
		output << "<children>"						<< endl;
		output << "<componentref id=\"block\" />"	<< endl;
		output << "</children>"						<< endl;
		output << "</component>"					<< endl;

		output << endl << endl;
		}

	output << endl;
	for (unsigned i = 0; i < component_names.size(); i++) {
		output << "<componentref id=\"" << component_names[i] << "\" />" << endl;
	}

	// write vector file
	output << "Writing this to a file.\n";
	output.close();
}
